class Student(object):
    @property
    def score(self):
        return self._score

    @score.setter
    def score(self, value):
        if not isinstance(value, int):
            raise ValueError('score must be an integer!')
        if value < 0 or value > 100:
            raise ValueError('score must between 0~100')
        self._score = value

    @property
    def birth(self):
        return self._birth

    @birth.setter
    def birth(self, value):
        self._birth = value

    @property
    def age(self):
        return 2015 - self._birth


s = Student()

s.score = 60

print(s.score)

# s.score = 999

# 上面的birth是可读写属性，而age就是一个只读属性，
# 因为age可以根据birth和当前时间计算出来。
s.birth = 2000
print(s.birth)

print(s.age)
